﻿namespace ParkingLot4
{
    public class ParkingLotManagerFactory
    {

        public IParkingLotManager GetParkingLotManager(string strategy)
        {
            IParkingLotManager manager;
            if (string.IsNullOrWhiteSpace(strategy))
                throw new ArgumentException("空策略");
            switch (strategy)
            {
                case nameof(ParkingLotManagerOfEmptyCountFirst):
                    manager = new ParkingLotManagerOfEmptyCountFirst();
                    break;
                case nameof(ParkingLotManagerOfIndexFirst):
                    manager = new ParkingLotManagerOfIndexFirst();
                    break;
                case nameof(ParkingLotManagerOfQuickFullFirst):
                    manager = new ParkingLotManagerOfQuickFullFirst();
                    break;
                default:
                    throw new ArgumentException("未匹配到策略");
            }
            return manager;
        }
    }
}
